using System;
using System.Collections.Generic;
using System.Text;

using NUnit.Framework;
using DataAccessLayer;

namespace Relationships
{
    [TestFixture]
    public class ReviewReviewerFixture : ConnectionFixture
    {
        [Test]
        public void ReviewerId()
        {
            RecordingDataSet recordingDataSet = new RecordingDataSet();

            ReviewGateway review = new ReviewGateway(Connection);
            long reviewId = review.Insert(33, "Test Review", recordingDataSet);

            ReviewerGateway reviewer = new ReviewerGateway(Connection);
            long reviewerId = reviewer.Insert("Test Reviewer", recordingDataSet);

            
            RecordingDataSet.ReviewRow row = review.FindById(reviewId, recordingDataSet);
            row.reviewerid = reviewerId;

            review.Update(recordingDataSet);

            Assert.AreEqual(reviewerId, row.ReviewerRow.id);

            review.Delete(reviewId, recordingDataSet);
            reviewer.Delete(reviewerId, recordingDataSet);

        }
    }
}
